package pers.xiaojun.boot.mybatis.core.util;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor;

import java.util.ArrayList;
import java.util.List;

/**
 * MybatisPlus 工具
 *
 * @author xiaojun
 * @since 2025-11-22
 */
public class MyBatisUtils {


    /**
     * 添加内部拦截器到指定位置
     *
     * @param interceptor MyBatisPlus 拦截器对象
     * @param inner       内部拦截器对象
     * @param index       位置
     */
    public static void addInnerInterceptor(MybatisPlusInterceptor interceptor, InnerInterceptor inner, int index) {
        List<InnerInterceptor> interceptors = new ArrayList<>(interceptor.getInterceptors());
        interceptors.add(index, inner);
        interceptor.setInterceptors(interceptors);
    }




}
